package com.whcoding.designpatterns.pattern.strategy;

/**
 * @program: spring-boot-learning
 * @description: 具体策略角色：折扣金额1元
 * @author: whcoding
 * @create: 2022-09-20 20:02
 **/
public class FlatRateStrategy extends AbstractDiscountStrategy {

	/**
	 * 折扣金额
	 */
	private int discountPrice;

	public FlatRateStrategy(double price, int copies) {
		super(price,copies);
	}

	/**
	 * 折扣金额 1
	 *
	 * @param discountPrice discountPrice
	 */
	public void setDiscountPrice(int discountPrice) {
		this.discountPrice = discountPrice;
	}


	/**
	 * 数量*单件
	 * @return
	 */
	@Override
	double calcDiscount() {
		return discountPrice * getCopies();
	}
}
